package com.horoscope.astrology.zodiac.signs.free.fragment;

import android.app.Dialog;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.Button;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;
import com.horoscope.astrology.zodiac.signs.free.R;

public class RatingDialogFragment extends DialogFragment {

    private Button btNope, btSure;
    private ClickResult clickRes;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
                             @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.rating_dialog_fragment, container);
        view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
        clickRes = (ClickResult) getActivity();
        btNope = view.findViewById(R.id.bt_nope);
        btNope.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                clickRes.onClickedListener(false);
            }
        });
        btSure = view.findViewById(R.id.bt_sure);
        btSure.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
//                FlurryEventUtil.INSTANCE.ratingSure();
                clickRes.onClickedListener(true);
            }
        });
        return view;
    }

    @NonNull
    @Override
    public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
        Dialog dialog = super.onCreateDialog(savedInstanceState);
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        return dialog;
    }

    /**
     * callback to activity interface
     */
    public interface ClickResult {
        void onClickedListener(boolean result);
    }


}
